export default {
  data() {
    return {
      callbackName: null,
      callbackProps: {},
    }
  },
  methods: {
    callbackComponent(h) {
      return this.callbackName
        ? h(this.callbackName, {
          props: this.callbackProps,
          on: {
            done: () => {
              // 回调组件的方法执行完毕后，销毁该组件
              this.callbackName = null
              this.callbackProps = {}
            },
          },
        })
        : ''
    },
    callback(options) {
      this.callbackName = options.component
      this.callbackProps = options.props
    },
  },
}
